import java.util.Scanner;

public class Main1449 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        int n=sc.nextInt();
        int b=0;
       for (int i=1;i<=n;i++){
           int a=0;
        if (i%2==0){
            a++;
        }if (i%3==0){
            a++;
        }if (i%5==0){
            a++;
        }if (i%7==0){
            a++;
        }if (a>=2){
            b=b+i;
           }
       }
        System.out.println(b);
    }
}